﻿using System;
using System.Runtime.InteropServices;

namespace IRUM.Utils
{
    public class Win32API
    {
        //Used for WM_COPYDATA for string messages
        public struct COPYDATASTRUCT
        {
            public IntPtr dwData;
            public int cbData;
            [MarshalAs(UnmanagedType.LPStr)]
            public string lpData;
        }

		public const string Seperator_String = "|";
		public const char Seperator_Char = '|';

		public const string Seperator_String_Sub = "\t";
		public const char Seperator_Char_Sub = '\t';

		public const string 종목분석정보경로 = @"\Analysis\";
		public const string 시간대별체결정보경로 = @"\TradingData\";
		public const string 종목분석로그파일명 = "update.log";
		public const string 종목리스트파일명 = "종목리스트.lst";

		public const string 종목차트정보경로 = @"\COM\";
		public const string 종목차트확장자_현재가정보 = ".bas";
		public const string 종목차트확장자_월봉 = ".mnt";
		public const string 종목차트확장자_주봉 = ".wek";
		public const string 종목차트확장자_일봉 = ".day";
		public const string 종목차트확장자_03분봉 = ".m03";
		public const string 종목차트확장자_30분봉 = ".m30";
		public const string 종목차트확장자_60분봉 = ".m60";
		public const string 종목체결정보확장자 = ".trd";

		public const string 뉴스저장경로 = @"\News\";
		public const string 뉴스정보확장자 = ".nws";

		public const string 이미지저장경로 = @"\IMG\";
		public const string 이미지확장자 = ".png";

        public const Int32 WM_USER = 0x400;
        public const Int32 WM_COPYDATA = 0x4A;
        public const Int32 WM_CLOSE = 0x10;


        //For use with WM_COPYDATA and COPYDATASTRUCT
        [DllImport("User32.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessage(int hWnd, int Msg, int wParam, ref COPYDATASTRUCT lParam);

        //For use with WM_COPYDATA and COPYDATASTRUCT
        [DllImport("User32.dll", EntryPoint = "PostMessage")]
        public static extern int PostMessage(int hWnd, int Msg, int wParam, ref COPYDATASTRUCT lParam);

        [DllImport("User32.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessage(int hWnd, int Msg, int wParam, int lParam);

        [DllImport("User32.dll", EntryPoint = "PostMessage")]
        public static extern int PostMessage(int hWnd, int Msg, int wParam, int lParam);
    }
}
